// ComInterface.h: interface for the CComInterface class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_COMINTERFACE_H__32FC5BDD_05F6_418A_B3E8_4CD4EF0EFFA6__INCLUDED_)
#define AFX_COMINTERFACE_H__32FC5BDD_05F6_418A_B3E8_4CD4EF0EFFA6__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "Activcard_i.c"
#include "Activcard.h"
#include "Atlbase.h"      // for usage of CComBSTR

#define  COMERROR  -21
#define  ERR_NOUSER  107
#define	 VALID_PWD	0
#define  WRONG_PWD	13
#define  ERR_TOKEN_DISABLED -128
#define  ERR_INTERNAL_USRE_NOT_ALLOWED -256
class CComInterface  
{
// Interface
public:
	bool CouldConnect();
	enum EAuthResult
	{
		Auth_ComError		= COMERROR,
		Auth_ValidPwd		= VALID_PWD,
		Auth_WrongPwd		= WRONG_PWD,
		Auth_NoUser			= ERR_NOUSER,
		Auth_TokenDisabled	= ERR_TOKEN_DISABLED
	};
	EAuthResult Authenticate(char* pszUsername, char* pszPassword);
// Construction/Destruction
public:
	CComInterface();
	virtual ~CComInterface();
// Data
public:
	IAuthentication * m_pAuthenTication;
protected:
	bool m_ifInitialized;
// Implement
protected:
	bool Initialize();
	bool CreateLocally();
	bool CreateRemotely(const CString& strIP);
	void Diagnose(HRESULT hresult);
	void Close();
};

#endif // !defined(AFX_COMINTERFACE_H__32FC5BDD_05F6_418A_B3E8_4CD4EF0EFFA6__INCLUDED_)
